package com.kun.valiant.web.controller.valiant.clue;

import com.kun.valiant.assignment.domain.Assignment;
import com.kun.valiant.assignment.service.IAssignmentService;
import com.kun.valiant.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 分配记录表 前端控制器
 * @author fangkun
 * @since 2023-06-08
 */
@RestController
@RequestMapping("/valiant/assignment")
public class AssignmentController {

    @Autowired
    IAssignmentService assignmentService;

    /**
     * 分配线索
     * @param assignment
     * @return
     */
    @PostMapping
    @PostAuthorize("hasAnyPermissions('valiant:clue:assignment','valiant:business:assignment')")
    public AjaxResult assignClue(@Validated @RequestBody Assignment assignment){
        return assignmentService.assignClue(assignment);
    }
}
